package com.huibei.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huibei.pojo.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {

    @Select(" SELECT od.*,hu.HOUSE_NAME,hu.HOUSE_CITY" +
            "  FROM tb_order as od,tb_house as hu" +
            "  WHERE od.HOUSE_ID = hu.HOUSE_ID AND" +
            "  od.USER_ID = #{userId} ")
   public List<Map<String, Object>> getOrderList(Map map);

    @Update("UPDATE tb_order AS o SET o.USER_NAME = #{odererName}," +
            "o.USER_PHONE = #{orderPhone} " +
            " WHERE o.ORDER_ID = #{orderId}")
    public int changeInfo(Map map);

    @Update("UPDATE tb_order SET ORDER_STATUS = 1 WHERE ORDER_ID = #{orderId}")
    public int changeStatus(Map map);

    @Update("UPDATE tb_order SET ORDER_STATUS = -1 WHERE ORDER_ID = #{orderId}")
    public int cancelOrder(Map map);


}
